package com.jhy.system.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import com.jhy.core.domain.BaseEntity;
import lombok.*;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 * 用户对象 sys_user
 *
 * @author Lion Li
 */

@Data
@TableName("sys_user")
public class SysUser extends BaseEntity {


    @TableId(value = "user_id", type = IdType.AUTO)
    private Long userId;




    @NotBlank(message = "用户账号不能为空")
    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
    private String userName;


    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    private String nickName;


    private String userType;

    /**
     * 用户邮箱
     */

    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    private String email;


    private String phonenumber;


//    @NotBlank(message = "请填写身份证号")
    private String idCard;


    private String sex;


    private String avatar;


    @TableField(
        insertStrategy = FieldStrategy.NOT_EMPTY,
        updateStrategy = FieldStrategy.NOT_EMPTY,
        whereStrategy = FieldStrategy.NOT_EMPTY
    )
//    @Pattern(regexp = "^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$\\-.+*_])(.{6,20})$",message = "密码应该由英文大小写、数字、符号(!@#$-.+*_)中组成，不少于6位")
    private String password;

    @JsonIgnore
    @JsonProperty
    public String getPassword() {
        return password;
    }


    private String status;


    @TableLogic
    private String delFlag;


    private String loginIp;


    private Date loginDate;




    private Integer lockStatus;



}
